home *** CD-ROM | disk | FTP | other *** search
- Subject: Solution...
- Sent: 9/18/96 10:32 AM
- Received: 9/18/96 10:32 AM
- From: Adam Nash <adamnash@CS.Stanford.EDU>
- Reply-To: ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List
-
-
- Hi Everyone,
- In a manner that I hope is emulated, I am going to post the
- solution to my problem, as provided by Thomas Weisbach of the OpenDoc team:
-
- The key is using the ODSession to resolve a particular type. So, in
- my case, I wanted really to resolv the ' snd' type, while others might
- want to resolve 'moov', 'PICT', '3DMF'.
-
- Here is the sample code that I used: (Note the use of TempODType, which
- is an OpenDoc utility (not in the OpenDoc API) It is in the OpenDoc Utility
- headers, TempObj.h
-
-
- // Get the proxy shape
- FW_CRect cellRect;
- fSparkView->GetProxyRect(ev, index, cellRect);
- cellRect.Place(FW_kZeroPoint);
-
- // Acquire the shape
- FW_CAcquiredODShape shape = ::FW_NewODShape(ev, cellRect);
-
- // Get the sound type...
- ODSession *session = FW_CSession::GetODSession(ev);
- TempODType type = session->GetTranslation(ev)->GetISOTypeFromPlatformType(ev,'snd ', kODPlatformDataType);
-
- // Ask our draft for the new part
- ODStorageUnit *su = fSparkPart->GetStorageUnit(ev);
- ODDraft *draft = su->GetDraft(ev);
- FW_CAcquiredODPart newPart = draft->CreatePart(ev, type, kODNoEditor);
-
- // Create a proxy for the part
- long silly_hack_here;
- proxy = new CSparkProxy(ev, fSparkPart, fSparkContent, "Untitled Sound", 123456L, FW_CTime::GetCurrentTime());
- proxy->SetCellIndex(index);
-
- // Add the Proxy to the part
- fSparkContent->AddProxy(proxy, index);
-
- // Embed the part into our content
- proxy->Embed(ev, GetPresentation(ev), newPart, NULL, kODFrameObject,
- shape,
- GetPresentation(ev)->GetDefaultEmbeddedFrameViewType(ev),
- NULL, 0, false, false);
-
-
-
- - Adam
-
- --
- Adam Nash
-
- "The opinions expressed above are not necessarily those of
- Apple Computer, Stanford University, or the United States
- of America."
-
- CS 198 Coordinator Apple Research Labs
- Stanford University - Computer Science Apple Computer, Inc.
- (415) 941-4094 (408) 974-5517
- adamnash@cs.stanford.edu adamnash@taurus.apple.com